<%@ page import="com.lagou.dao.StudentViewDaoImp" %>
<%@ page import="com.lagou.dao.StudentViewDao" %>
<%@ page import="com.lagou.bean.Student" %>
<%@ page import="java.util.List" %>
<%@ page import="com.lagou.service.StudentViewSerive" %><%--
  Created by IntelliJ IDEA.
  User: 92592
  Date: 2021/7/19
  Time: 15:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="css/main.css">
    <link rel="stylesheet" href="css/bootstrap.min.css">

</head>
<body>
<header>
    <h1>学生信息管理系统</h1>
</header>

<div class="title">

    <%= "管理员:" + session.getAttribute("userName")%>

</div>

<body style="padding: 30px;">

<!-- 实现CURD按键 -->
<form class="form-inline">
    <button class="btn btn-primary " id="add" data-toggle="modal" data-target="#myModal" type="button">新增</button>
    <button class="btn btn-primary" id="del" data-toggle="modal" data-target="#delModal" type="button">删除</button>
    <button class="btn btn-primary" id="updata" data-toggle="modal" data-target="#updateModal" type="button">修改</button>
    <button class="btn btn-primary" id="select" data-toggle="modal" data-target="#selectModal" type="button">查询</button>
</form>

<!-- 声明定义添加模态框组件 -->
<div class="modal" id="myModal" data-backdrop="static">
    <!-- 窗口声明 -->
    <div class="modal-dialog">
        <!-- 内容声明 -->
        <div class="modal-content">
            <!-- 1.框的标题 -->
            <div class="modal-header">
                <button class="close" data-dismiss="modal">
                    <span>&times;</span>
                </button>
                <h4 class="modal-title">添加学员</h4>
            </div>
            <!-- 2.框内信息 -->
            <div class="modal-body">
                <form action="StudentServlet" method="post">
                    <div class="form-group">
                        <label>学号</label>
                        <input type="text" class="form-control" id="id" name="sid">
                    </div>

                    <div class="form-group">
                        <label>姓名</label>
                        <input type="text" class="form-control" id="name" name="sname">
                    </div>
                    <div class="form-group">
                        <label>性别</label>
                        <input type="text" class="form-control" id="sex" name="sex">
                    </div>
                    <div class="form-group">
                        <label>出生日期</label>
                        <input type="date" class="form-control" id="birthday" name="birthday">
                    </div>
                    <div class="form-group">
                        <label>邮箱</label>
                        <input type="email" class="form-control" id="email" name="email">
                    </div>
                    <div class="form-group">
                        <label>备注</label>
                        <input type="text" class="form-control" id="content" name="content">
                    </div>
                    <!-- 3.框的按钮 -->
                    <div class="modal-footer" id="sub">
                        <input type="submit">
                    </div>
                </form>
            </div>

        </div>
    </div>
</div>
<!-- 声明定义删除模态框组件 -->
<div class="modal" id="delModal" data-backdrop="static">
    <!-- 窗口声明 -->
    <div class="modal-dialog">
        <!-- 内容声明 -->
        <div class="modal-content">
            <!-- 1.框的标题 -->
            <div class="modal-header">
                <button class="close" data-dismiss="modal">
                    <span>&times;</span>
                </button>
                <h4 class="modal-title">删除学员</h4>
            </div>
            <!-- 2.框内信息 -->
            <div class="modal-body">
                <form action="DelSudentServlet" method="post">
                    <div class="form-group">
                        <label>请输入要删除学生的学号</label>
                        <input type="text" class="form-control"  name="del">
                    </div>

                    <!-- 3.框的按钮 -->
                    <div class="modal-footer" >
                        <input type="submit" value="删除">
                    </div>
                </form>
            </div>

        </div>
    </div>
</div>
<!-- 声明定义修改模态框组件 -->
<div class="modal" id="updateModal" data-backdrop="static">
    <!-- 窗口声明 -->
    <div class="modal-dialog">
        <!-- 内容声明 -->
        <div class="modal-content">
            <!-- 1.框的标题 -->
            <div class="modal-header">
                <button class="close" data-dismiss="modal">
                    <span>&times;</span>
                </button>
                <h4 class="modal-title">修改学员</h4>
            </div>
            <!-- 2.框内信息 -->
            <div class="modal-body">
                <form action="UpdateStudentServlet" method="post">
                    <div class="form-group">
                        <label>请输入要修改生的学号</label>
                        <input type="text" class="form-control"  name="update">
                    </div>
                    <div class="form-group">
                        <label>新的学号</label>
                        <input type="text" class="form-control"  name="sid">
                    </div>

                    <div class="form-group">
                        <label>新的姓名</label>
                        <input type="text" class="form-control" name="sname">
                    </div>
                    <div class="form-group">
                        <label>新的性别</label>
                        <input type="text" class="form-control" name="sex">
                    </div>
                    <div class="form-group">
                        <label>新的出生日期</label>
                        <input type="date" class="form-control" name="birthday">
                    </div>
                    <div class="form-group">
                        <label>新的邮箱</label>
                        <input type="email" class="form-control"  name="email">
                    </div>
                    <div class="form-group">
                        <label>新的备注</label>
                        <input type="text" class="form-control"  name="content">
                    </div>
                    <!-- 3.框的按钮 -->
                    <div class="modal-footer" >
                        <input type="submit">
                    </div>
                </form>
            </div>

        </div>
    </div>
</div>

<!-- 声明定义查找模态框组件 -->
<div class="modal" id="selectModal" data-backdrop="static">
    <!-- 窗口声明 -->
    <div class="modal-dialog">
        <!-- 内容声明 -->
        <div class="modal-content">
            <!-- 1.框的标题 -->
            <div class="modal-header">
                <button class="close" data-dismiss="modal">
                    <span>&times;</span>
                </button>
                <h4 class="modal-title">查找学员</h4>
            </div>
            <!-- 2.框内信息 -->
            <div class="modal-body">
                <form action="SelectStudentServlet" method="post">
                    <div class="form-group">
                        <label>请输入要查找学生的学号</label>
                        <input type="text" class="form-control"  name="select">
                    </div>

                    <!-- 3.框的按钮 -->
                    <div class="modal-footer" >
                        <input type="submit" value="查找">
                    </div>
                </form>
            </div>

        </div>
    </div>
</div>
<!-- 表格显示员工信息-->
<table class="table table-hover">
    <caption>学员信息</caption>

    <thead>

    <tr>
        <th>学号</th>
        <th>姓名</th>
        <th>性别</th>
        <th>出生日期</th>
        <th>邮箱</th>
        <th>备注</th>
    </tr>
    </thead>
    <tbody>
    <% StudentViewSerive studentViewSerive = new StudentViewSerive();
        List<Student> students = studentViewSerive.studentView();
        for (Student student : students) {
    %>

    <tr >
        <td><%= student.getSid()%></td>
        <td><%= student.getSname()%></td>
        <td><%= student.getSex()%></td>
        <td><%= student.getBirthday()%></td>
        <td><%= student.getEmail()%></td>
        <td><%= student.getContent()%></td>
    </tr>

    <% } %>
    </tbody>


</table>
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>

<script>

</script>
</body>
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/bootstrap.js"></script>
</body>
</html>